//
//  SearchAddProductViewController.m
//  quickBatchManager
//
//  Created by jack on 15/11/17.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "SearchAddProductViewController.h"

@interface SearchAddProductViewController ()

@end

@implementation SearchAddProductViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)initUI
{
    UIImage *image = _bg.image;
    image = [image stretchableImageWithLeftCapWidth:floorf(image.size.width/2) topCapHeight:floorf(image.size.height/2)];
    _bg.image=image;
    self.view.backgroundColor=[UIColor clearColor];
    [_closeBtn bk_whenTapped:^{
        [self dismissViewControllerAnimated:YES completion:nil];
    }];
    
    [_searchBtn bk_whenTapped:^{
        NSMutableDictionary *whereDict = [NSMutableDictionary dictionary];
        if([_modeNumberTextField.text isValid])
        {
            [whereDict setObject:_modeNumberTextField.text forKey:@"modelNo"];
        }
        if ([_supperTextField.text isValid])
        {
            [whereDict setObject:_supperTextField.text forKey:@"supperName"];
        }
        if ([_numberTextField.text isValid])
        {
            [whereDict setObject:_numberTextField.text forKey:@"number"];
        }
        if ([_moneyTextField.text isValid])
        {
            [whereDict setObject:_moneyTextField.text forKey:@"money"];
        }
        [self dismissViewControllerAnimated:YES completion:nil];
        if(_delegate &&[_delegate respondsToSelector:@selector(searchAddProductResult:)])
        {
            NSLog(@"=======result");
            [_delegate searchAddProductResult:whereDict];
        }
    }];
    
    
    [_reSetBtn bk_whenTapped:^{
        
    }];
}

@end
